const { ccclass, property } = cc._decorator;

@ccclass
export default class DetailControl extends cc.Component {
    @property(cc.Node)
    valueNode: cc.Node = null;
    grade: cc.Label = null;
    life: cc.Label = null;
    damage: cc.Label = null;
    armorC: cc.Label = null;
    armorA: cc.Label = null;
    lifeRe: cc.Label = null;
    onLoad() {
        this.grade = this.valueNode.getChildByName("grade").getComponent(cc.Label);
        this.life = this.valueNode.getChildByName("life").getComponent(cc.Label);
        this.damage = this.valueNode.getChildByName("damage").getComponent(cc.Label);
        this.armorC = this.valueNode.getChildByName("armorC").getComponent(cc.Label);
        this.armorA = this.valueNode.getChildByName("armorA").getComponent(cc.Label);
        this.lifeRe = this.valueNode.getChildByName("lifeRe").getComponent(cc.Label);
    }
    setvalue(detail: any) {
        this.grade.string = detail.Grade + "/50";
        this.life.string = detail.Life;
        this.damage.string = Math.abs(detail.Damage).toFixed(0);
        this.armorC.string = detail.ArmorC;
        this.armorA.string = detail.ArmorA;
        this.lifeRe.string = detail.LifeRe + "/秒";
    }
}
